/* Copyright 2021 Kerim Yalcin
**
**   Licensed under the Apache License, Version 2.0 (the "License");
**   you may not use this file except in compliance with the License.
**   You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
**   Unless required by applicable law or agreed to in writing, software
**   distributed under the License is distributed on an "AS IS" BASIS,
**   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
**   See the License for the specific language governing permissions and
**   limitations under the License.
*/

#ifndef AGX_FILE_HEADER
#define AGX_FILE_HEADER

#include <iostream>
#include <string>

#include <windows.h>

namespace Agx {

class File {
    private:

        HANDLE mFileHandle;
        DWORD mDesiredAccess;
        DWORD mShareMode;
        LPSECURITY_ATTRIBUTES mSecurityAttributes;
        DWORD mCreationDisposition;
        DWORD mFlagsAttributes; 
        
        std::string mVolume;
        std::string mDirectory;
        std::string mFileName;
        std::string mFileExtension;

    public:
        File();

        void enable_DesiredAccess_Read();
        void disable_DesiredAccess_Read();
        void enable_DesiredAccess_Write();
        void disable_DesiredAccess_Write();

        const DWORD& get_DesiredAccess_coded();
        const std::string get_DesiredAccess_stringed();


        void enable_FileShare_Delete();
        void disable_FileShare_Delete();
        void enable_FileShare_Read();
        void disable_FileShare_Read();
        void enable_FileShare_Write();
        void disable_FileShare_Write();

        const DWORD& get_FileShare_coded();
        const std::string get_FileShare_stringed();


        void set_CreationDisposition_CreateAlways();
        void set_CreationDisposition_CreateNew();
        void set_CreationDisposition_OpenAlways();
        void set_CreationDisposition_OpenExisting();
        void set_CreationDisposition_TruncateExisting();

        const DWORD& get_CreationDisposition_coded();
        const std::string get_CreationDisposition_stringed();


        DWORD get_FlagsAttributes_coded();
        const std::string& get_FlagsAttributes_stringed();


        void set_Directory(const std::string& pDirectory);
        const std::string& get_Directory();

        void set_Extension(const std::string& pExtension);
        const std::string& get_Extension();

        void set_FileName(const std::string& pFileName);
        const std::string& get_FileName();

        void create_File();
};

}

#endif